Component({
    properties: {
        datas: {
            type: null
        },
        component_id: {
            type: null
        }
    },
    data: {
        emptyImage: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/image.png",
        clientWidth: "375",
        video: {},
        Height: "200",
        imgurlshow: !0,
        isVideo: !1
    },
    lifetimes: {
        attached: function() {
            console.log(this.properties.datas);
        },
        moved: function() {},
        detached: function() {}
    },
    attached: function() {},
    ready: function() {
        this.isMp4(this.data.datas.video_url.video_url);
        var t = "myVideo".concat(this.data.component_id);
        this.videoContext = wx.createVideoContext(t, this), this.setData({
            video: this.data.datas.video_url.video_url
        }), "0" == this.data.datas.video_url.isShowPoster ? this.setData({
            imgurl: ""
        }) : this.setData({
            imgurl: this.data.datas.video_url.poster
        }), this.videoScrollHandle();
    },
    pageLifetimes: {
        show: function() {},
        hide: function() {},
        resize: function() {}
    },
    methods: {
        isMp4: function(t) {
            t.endsWith(".mp4") ? this.setData({
                isVideo: !0
            }) : this.setData({
                isVideo: !1
            });
        },
        imgurlshowbtn: function() {
            this.videoContext.play(), this.setData({
                imgurlshow: !1
            });
        },
        bindended: function() {
            this.setData({
                imgurlshow: !0
            });
        },
        bindloadedmetadata: function(t) {
            var i = wx.getSystemInfoSync().windowWidth * t.detail.height / t.detail.width + "px";
            parseInt(i) && this.setData({
                Height: parseInt(i) + "px"
            });
        },
        videoScrollHandle: function() {
            var t = this, i = "#myVideo".concat(this.data.component_id);
            this.createIntersectionObserver().relativeToViewport().observe(i, function(i) {
                0 === i.intersectionRatio && t.videoContext.pause();
            });
        }
    }
});